//加载http模块
var http = require("http");
var iconv = require("iconv-lite");

//目标网站，电影天堂
var pageUrl = "http://www.ygdy8.com/html/tv/hytv/20180109/56048.html";

http.get(pageUrl, function(res) {
  var chunks = [];
  res.on("data", function(chunk) {
    chunks.push(chunk);
  });
  res.on("end", function() {
    var decodedBody = iconv.decode(Buffer.concat(chunks), "gbk");
    console.log(decodedBody.match(/ftp:\S*.[mp4|rmvb|mkv]/g).join("\n"));
  });
});
